<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" />
<title>코오롱</title>
<link rel="stylesheet" type="text/css" href="${requestScope.contextPath}/css/import.css" />
<script type="text/javascript" src="${requestScope.contextPath}/js/jquery-ui-1.8.14.custom/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="${requestScope.contextPath}/js/jquery-ui-1.8.14.custom/js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="${requestScope.contextPath}/js/common.js"></script>
<c:set var="userAgent" value="${header['User-Agent']}" />
<fmt:setBundle basename="com.kolon.config.properties.config" var="config" />
<c:if test="${fn:indexOf(userAgent, 'Android') != -1}"><c:set var="platForm" value="Android" /></c:if>
<c:if test="${fn:indexOf(userAgent, 'iPhone') != -1}"><c:set var="platForm" value="iPhone" /></c:if>
<script type="text/javascript">
function appBack() {
	document.location.href='#';
}
</script>
<link rel="stylesheet" type="text/css" href="/js/jquery-ui-1.8.14.custom/css/ui-lightness/jquery-ui-1.8.14.custom.css" />

<script type="text/javascript">
function goSubmit() {
	//요청범위 체크
	if(document.form.requestarea.value==""){
	  alert("서비스 요청범위를 선택하세요!");
	  document.form.requestarea.focus();
	  return false;
	}
	
	//요청내역 체크
	if(document.form.detail.value==""){
	  alert("요청내역을 입력하세요!");
	  documentform.detail.focus();
          return false;
	}

	//요청내역 Max 1,000자 체크
	if ( document.form.detail.value.length > 1000 )
		{
			alert( "요청내용은 1000자로 제한됩니다. 긴 문장은 첨부파일로 첨부해 주시기 바랍니다. \n현재 " + eval(document.form.detail.value.length ) + "자 입니다." );
			document.form.detail.focus();
			return false;
		}

	//희망완료일 체크
	if(document.form.timestamp.value==""){
	  alert("희망완료일을 선택하세요!");
	  document.form.timestamp.focus();
	  return false;
	}
	if (confirm('서비스 요청을 하시겠습니까?')) {
		return true;
	}
	return false;
}

$(function() {
	var dates = $('#timestamp').datepicker({
		showOn: "button",
		buttonImage: "${requestScope.contextPath}/images/reservation/cal1.gif",
		buttonImageOnly: true,
		numberOfMonths: 1,
		dateFormat: 'yy-mm-dd',
		showMonthAfterYear:true,
		showButtonPanel: true,
		monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
		dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
		onSelect: function(selectedDate) {
			var option = this.id == "startdate" ? "minDate" : "maxDate";
			var instance = $(this).data("datepicker");
			var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
			dates.not(this).datepicker("option", option, date);
		}
	});
});
</script>
</head>
<body>
<div id="wrap">
		<div class="header">
			<h1>SERVICE DESK</h1>
		</div><!-- // header -->
		<div class="content">
			<c:choose>
	       	<c:when test="${approval eq 'True' and assignee eq 'False'}">
	       	<!-- 승인대기 -->
			<ul class="tab2">
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequest.do"><img src="${requestScope.contextPath}/images/service/tab3_1_over.gif" alt="서비스요청" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequestList.do"><img src="${requestScope.contextPath}/images/service/tab3_2.gif" alt="요청현황" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskApplyList.do"><img src="${requestScope.contextPath}/images/service/tab3_3.gif" alt="승인대기" /></a></li>
			</ul>
			</c:when>
			<c:when test="${approval eq 'False' and assignee eq 'True'}">
			<!-- 처리자 -->
			<ul class="tab2">
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequest.do"><img src="${requestScope.contextPath}/images/service/tab4_1_over.gif" alt="요청" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequestList.do"><img src="${requestScope.contextPath}/images/service/tab4_2.gif" alt="요청현황" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskProcessList.do"><img src="${requestScope.contextPath}/images/service/tab4_4.gif" alt="처리현황" /></a></li>
			</ul>
			</c:when>
			<c:when test="${approval eq 'True' and assignee eq 'True'}">
			<!-- 승인자/처리자 -->
			<ul class="tab2">
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequest.do"><img src="${requestScope.contextPath}/images/service/tab4_1_over.gif" alt="요청" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequestList.do"><img src="${requestScope.contextPath}/images/service/tab4_2.gif" alt="요청현황" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskApplyList.do"><img src="${requestScope.contextPath}/images/service/tab4_3.gif" alt="승인대기" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskProcessList.do"><img src="${requestScope.contextPath}/images/service/tab4_4.gif" alt="처리현황" /></a></li>
			</ul>
			</c:when>
			<c:otherwise>
			<!-- 요청자 -->
			<ul class="tab2">
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequest.do"><img src="${requestScope.contextPath}/images/service/tab2_1_over.gif" alt="서비스 요청" /></a></li>
				<li><a href="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequestList.do"><img src="${requestScope.contextPath}/images/service/tab2_2.gif" alt="요청현황" /></a></li>
			</ul>
			</c:otherwise>
			</c:choose>
			<div class="service">
				<form name="form" action="${requestScope.contextPath}/business/mServiceDesk_/mServiceDeskRequest.do" method="post" onsubmit="return goSubmit();" >
				<div class="table5">
					<table summary="" cellspacing="0" style="width:100%;">
						<caption>서비스 요청</caption>
						<colgroup>
							<col style="width:20%" />
							<col style="width:80%" />
						</colgroup>
						<tbody>

							<tr>
								<th scope="row">요청영역</th>
								<td>
									<select name="requestarea" style="width:95%;">
										<option value="">서비스 영역을 선택해 주세요!</option>
										<c:forEach items="${mapList}" var="mapInfo" varStatus="status">
										<option value="${mapInfo.PC_CODE }">${mapInfo.PC_DESC }</option>
										</c:forEach>
									</select>
								</td>
							</tr>
							<tr>
								<th scope="row">요청내역</th>
								<td><textarea cols="" rows="10" class="comment" name="detail"></textarea></td>
							</tr>
							<tr>
								<th scope="row">희망완료일</th>
								<td><input type="text" name="timestamp" class="intxt5" readonly="readonly" id="timestamp" value="${plusDate}" /></td>
							</tr>
						</tbody>
					</table>
				</div>
				<p class="btn_more"><input type="image" src="${requestScope.contextPath}/images/btn/btn_request.gif" alt="요청" /></a>&nbsp;&nbsp;<img src="${requestScope.contextPath}/images/btn/btn_reset.gif" alt="취소" onclick="history.back(-1);" /></p>
				</form>
			</div>
		</div><!-- // content -->
	</div><!-- // wrap -->
	<script>
		window.HybridApp.clearAllHistory(); 
	</script>
</body>
</html>